import javax.microedition.lcdui.Display;
import javax.microedition.midlet.MIDlet;



//-----------------------------------------------------------------------------
/// MIDlet Class
//-----------------------------------------------------------------------------


// --- Please do not modify this code ---



//-------------------------------------------------------------------------
/// &class cMIDlet (see config.bat to set MIDlet name through define)
/// &brief main entry point of this application
//-------------------------------------------------------------------------

public class HMIDlet  extends MIDlet

{
	/// this cGame instance
	public static cGame             s_gameInstance;
	public static HMIDlet            s_cMIDletInstance;

	//---------------------------------------------------------------------
	///  constructor
	//---------------------------------------------------------------------
	public HMIDlet  ()
	{
		/*try {
			Class.forName("GLLib");
			Class.forName("ASprite");
			Class.forName("cActor");
			Class.forName("cActorEnemy");
			Class.forName("cActorMC");
			Class.forName("cActorController");
		} catch (Exception e) {}*/
		
		s_cMIDletInstance = this;
	}

	//--------------------------------------------------------------------------
	/// &brief called by the system to start the game for the first time or resume it from a pause
	//--------------------------------------------------------------------------

	public void startApp ()

	{
		if (s_gameInstance == null)
		{
			s_gameInstance = new cGame(this, Display.getDisplay(this)); 
			s_gameInstance.Init();
		}
		s_gameInstance.Resume();
	}
	public static void EnableSound(boolean isEnable)
	{
		//cGame.s_isSoundEnabled = isEnable;
	}
	public static byte TranslateKeyCode(int keycode)
	{
		return (byte)cGame.Game_TranslateKeyCode(keycode);
	}
	public static void SetupDefaultKey ()
	{
		cGame.SetupDefaultKey();
	}
	//--------------------------------------------------------------------------
	/// &brief called by the system to pause the game
	//--------------------------------------------------------------------------
	public void pauseApp ()
	{
		s_gameInstance.Pause();
	}

	//--------------------------------------------------------------------------
	/// &brief called by the system to quit the game
	//--------------------------------------------------------------------------
	public void destroyApp (boolean unconditional)
	{
		if (s_gameInstance != null)
		{
			//s_gameInstance.RMS_Save();
			GLLib.Quit();
		}
	}
}

// !BLACKBERRY
// !BLACKBERRY

//USE_QUICK_SIMPLE_CANVAS


